#pragma once
#include "GameObject.h"
#include "../SGD Wrappers/SGD_Math.h"
#include "Events\IListener.h"

class MovingPlatform : public GameObject, public IListener
{
	float BASESPEED;
	//Speed of moving platform
	tVector2D velocity;

	//is currently moving forward through waypoints, or backwards?
	bool isReversed;
	//Is the platform moving at all/powered by something?
	bool isPowered;

	//vector of waypoints to move through.
	vector<POINT> waypoints;
	//last waypoint passed
	int lastWaypoint;
	//Vector pointing to the next waypoint
	tVector2D toWaypoint;

	//Checkpoint Data
	bool		CheckPointIsReversed;
	bool		CheckPointIsPowered;
	bool		OnlyRevOnce;
	float		ReverseTimer;
	int			CheckpointLastWayPoint;

public:
	MovingPlatform(void);
	virtual ~MovingPlatform(void);

	//Standard Overrides
	virtual void Update(float deltaTime);
	virtual void Render(void) const;
	virtual void HandleCollision(GameObject& other, CollisionInfo& info);

	//Check point Functions
	virtual void SetCheckPointData();
	virtual void ResetToCheckPoint();

	//Event handling
	virtual void HandleEvent(Event* pEvent) override;


	//Additional accessors/mutators
	tVector2D GetVelocity() const;
	void SetIsPowered(bool power) {isPowered = power;};
	void AddWaypoint(POINT pointToAdd);
	void SetBaseSpeed(float speed);
	unsigned int GetWaypointCount(void) const;

};

